package com.winsdom.dto;


import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

@Data
public class AccountInformationDTO{
    //登录账号
    private String username;
    //姓名
    private String name;
    //手机号码
    private String phone;
    //角色
    private String roleName;
    //状态
    private Integer status;
    @Schema(name = "页号", description = "分页页码（从1开始）", example = "1")
    @NotNull(message = "页号不能为空")
    @Min(value = 1, message = "页号必须大于等于1")
    private Integer pageNum;

    @Schema(name = "每页数量", description = "每页返回的数据条数", example = "10")
    @NotNull(message = "每页数量不能为空")
    @Min(value = 1, message = "每页数量必须大于等于1")
    private Integer pageSize;
    //数据起始页
    private int offset;

    // 动态计算 offset
    public int getOffset() {
        return (pageNum - 1) * pageSize;
    }
}
